@extends('admin.layout')
@section('content')

    <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
        <div class="col-md-12" id="content">
            <h2>重置密码</h2>
            <form class="form-horizontal">
                <div class="form-group">
                    <label for="upload_file" class="col-sm-2 control-label"><span style="color:red;">*</span>输入新密码</label>
                    <div class="col-sm-10">
                        <input type="password" class="form-control" style="width:300px;" name="password" id="password">
                    </div>
                </div>
                <div class="form-group">
                    <label for="upload_file" class="col-sm-2 control-label"><span style="color:red;">*</span>确认密码</label>
                    <div class="col-sm-10">
                        <input type="password" class="form-control" style="width:300px;" name="password_confirmation" id="password_confirmation">
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <input type="button" onclick="check()" value="确定">

                    </div>
                </div>
            </form>
        </div>
    </div>
    <script>
        function check(){
            var password=$('#password').val();
            var password_confirmation=$('#password_confirmation').val();
            var _token="{{csrf_token()}}";
            $.ajax({
                url:'/adm/user/edit-user/{{$oUser->id}}',
                type:'post',
                dataType:'json',
                data:{'password':password,'password_confirmation':password_confirmation,'_token':_token},
                success:function (data){
                    if (data.success){
                        alert(data.msg);
                        location.href='/adm/user';
                    }else {
                        alert(data.msg);
                    }
                },
                error:function (data){
                    alert(data.msg);
                }
            });
        }
    </script>
@endsection
